<template>
  <div>
    <!-- 头部面包屑 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>货物信息</el-breadcrumb-item>
      <el-breadcrumb-item>审核货物</el-breadcrumb-item>
    </el-breadcrumb>
    <GoodsForm :page-data="$store.state.checkData"
               class="goodsfrom"
               :total-data="$store.state.checkData"
               @handleEdit="pushGoods" @deleteRow="deleteCheckGoods">
      <span slot="push">入库</span>
    </GoodsForm>
  </div>
</template>

<script>
import GoodsForm from "@/components/goods/childComps/GoodsForm";

export default {
  name: "CheckGoods",
  data() {
    return {
      // 要入库的货物
      pushgoodsinfo: {}
    }

  },
  components: {
    GoodsForm
  },
  methods: {
    // 确认弹窗
    open() {
      this.$confirm('确认入库吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$store.commit('pushGoods', this.pushgoodsinfo)
        console.log('正在入库')
        this.$message({
          type: 'success',
          message: '入库成功!'
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消'
        });
      });
    },
    pushGoods(data) {
      this.pushgoodsinfo = data
      this.open()
    }
    ,
    deleteCheckGoods(data) {
      this.$store.commit('deleteCheckGoods', data)
    }
  }

}
</script>

<style scoped>
.goodsfrom {
  margin-top: 20px;
}
</style>